package com.hl.card.modular.pack.controller;

import com.hl.card.modular.pack.service.LoginDayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.io.IOException;

/**
 * <p>
 * 每日签到 前端控制器
 * </p>
 *
 * @author ZhouYongBang
 * @since 2018-06-20
 */
@RestController
@RequestMapping("/api/loginDay")
public class LoginDayController {

	private static final Logger logger = LoggerFactory.getLogger(UserDataController.class);

	
	@Resource(name="stringRedisTemplate")
    private StringRedisTemplate stringRedisTemplate;
	
	/**
     * 获取每日签到
     * @return
     */
/*	 @PostMapping("/getLoginDay")	  
	  public Object getLoginDay(LogjnDay loginDay ) {
		    Map<String,Object> map=new HashMap<>();
	        try {
	        	 LoginDayService.getLoginDayInfo(loginDay);
	            map.put("code","1");
	            map.put("msg","每日签到成功并显示信息");
	            map.put("data",loginDay);
	            System.out.println("显示签到信息"+map.toString());
	        }catch (Exception ex){
	            logger.info(ex.getMessage());
	            map.put("code","0");
	            map.put("msg","签到失败");
	            map.put("data","");
	        }
	        return  map;
	
	 
	 }
	*/
	 @PostMapping("/getLoginDay")	  
	  public Object getLoginDay(String userId ,Integer loginNumber ) throws IOException {
		 
		 String getLoginDayInfo = "";
		 getLoginDayInfo = LoginDayService.getLoginDayInfo(userId,loginNumber,stringRedisTemplate);
		 
		return getLoginDayInfo;

	 }
	
	
	
	
	
	
	
	
	
	
}
